<template>
  <div class="dialog-container">
    <el-dialog :visible.sync="showAdd" width="60%" top="1%" :title="titles[btnType]" :before-close="handleClose">
      <el-form ref="form" :model="form">
        <div class="modal-content">
          <table class="table-container">
            <tbody>
              <tr>
                <td class="td-label-2">
                  <must />部门编码
                </td>
                <td>
                  <el-input v-model="form.deptCode" v-validate="'required|max:6'" name="部门编码" placeholder="请输入部门编码">
                  </el-input>
                  <span v-show="errors.has('行政区划代码')" style="color: red;">{{ errors.first('行政区划代码') }}</span>
                </td>
                <td class="td-label-2">上级部门</td>
                <td>
                  <el-input v-model="form.pid" v-validate="'max:50'" name="上级部门" placeholder="请输入上级部门">
                  </el-input>
                </td>
              </tr>
              <tr>
                <td class="td-label-2">
                  <must />部门名称
                </td>
                <td colspan="3">
                  <el-input v-model="form.deptName" v-validate="'required|max:100'" name="部门名称" placeholder="请输入部门名称">
                  </el-input>
                  <span v-show="errors.has('部门名称')" style="color: red;">{{ errors.first('部门名称') }}</span>
                </td>
              </tr>
              <tr>
                <td class="td-label-2">
                  <must />部门级别
                </td>
                <td>
                  <el-input v-model="form.deptLevel" v-validate="'required'" name="部门级别" placeholder="请输入部门级别"></el-input>
                  <span v-show="errors.has('部门级别')" style="color: red;">{{ errors.first('部门级别') }}</span>
                </td>
                <td class="td-label-2">
                  <must />状态
                </td>
                <td>
                  <el-radio-group v-model="form.status" name="状态" v-validate="'required'">
                    <el-radio-button v-for="(val, key) in allDictData.statusOps" :label="key" :key="key">{{val}}
                    </el-radio-button>
                  </el-radio-group>
                </td>
              </tr>

            </tbody>
          </table>
        </div>
      </el-form>
      <div slot="footer">
        <el-button @click="handleClose" type="danger">关 闭</el-button>
        <el-button @click="handleSave" type="primary" :disabled="btnDisabled">保 存</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  /* mixins */
  import addUpdateMixin from '@/mixins/addUpdate/addUpdateMixin.js'
  import uploadImgMixin from '@/mixins/addUpdate/uploadImgMixin.js'

  export default {
    /*  内容: dept_addUpdate */
    name: 'dept_addUpdate',
    data() {
      return {
        form: {
          pid: '',
          deptCode: '',
          deptName: '',
          deptLevel: '',
          leaderId: '',
          status: '1',
          memo: '',
        },
      }
    },
    mixins: [addUpdateMixin, uploadImgMixin],
    props: ['allDictData'],
    methods: {

    } // methods end
  }
</script>
<style scoped>
  @import "~@/styles/form.css";
</style>
